//
//  OnlinePayment.m
//  bbqpitbooking
//
//  Created by Win Kyi Tin on 5/31/11.
//  Copyright 2011 iss. All rights reserved.
//

#import "OnlinePayment.h"
#import "ConfirmPayment.h"
#import "ParticularModel.h"

@implementation OnlinePayment


@synthesize txtCardName,txtCardNo,txtNumber,txtAmt;

//*******************************************************************************************************************

//btn Payment event

-(IBAction) ConfirmPayment:(id)sender{
	
	
	NSString *name= txtCardName.text;
	NSString *cardno= txtCardNo.text;
	NSString *pinnumber= txtNumber.text ;
	NSString *amt= txtAmt.text;
	
	NSLog(@"Card Name %@",name);
	
	BOOL result = [particularModel cardDetails:name andCardNo:cardno  andPinNo:pinnumber andAmount :amt];
	
	NSLog(@"log %i",result);
	
	if (result){
		
		ConfirmPayment *confirmPayment = [[ConfirmPayment alloc]
										  initWithNibName:@"ConfirmPayment"
										  bundle:nil];
		[self.navigationController pushViewController:confirmPayment animated:YES];
		[confirmPayment release]; 
	}
	else {
		UIAlertView *alertPopUp=[[UIAlertView alloc]
								 initWithTitle:@"BBQ Pit Booking" message:@"Please enter the required information!" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
		[alertPopUp show];
		[alertPopUp release];
	}


	
}


//*******************************************************************************************************************

-(void) viewDidLoad {
	
	[super viewDidLoad];
	self.title = @"Online Payment";
	
	txtCardName.delegate =self;
	txtCardNo.delegate =self;
	txtAmt.delegate=self;
	txtNumber.delegate=self;
	particularModel = [[ParticularModel alloc]init];
}


-(BOOL) textFieldShouldReturn:(UITextField *)textField{

	[txtCardName resignFirstResponder];
	[txtCardNo resignFirstResponder];
	[txtNumber resignFirstResponder];
	[txtAmt resignFirstResponder];
	
	return YES;
}

- (void)didReceiveMemoryWarning {
    // Releases the view if it doesn't have a superview.
    [super didReceiveMemoryWarning];
    
    // Release any cached data, images, etc. that aren't in use.
}

- (void)viewDidUnload {
    [super viewDidUnload];
    // Release any retained subviews of the main view.
    // e.g. self.myOutlet = nil;
}


- (void)dealloc {
    [super dealloc];
}


@end
